from rest_framework import serializers
from .models import Chat,Accountmanage,Collection,Customer,Evalution,History,Include,Product,Sale,Saleorder,Saler

class ChatSerializer(serializers.ModelSerializer):
    class Meta:
        model = Chat
        fields = ('sender','receiver','chatdate','content','figure','chatstatus')

class AccountmanageSerializer(serializers.ModelSerializer):
    class Meta:
        model = Accountmanage
        fields = ('account','upassword','identify','blacklist')

class CollectionSerializer(serializers.ModelSerializer):
    class Meta:
        model = Collection
        fields = ('customeraccount', 'saleraccount')


class CustomerSerializer(serializers.ModelSerializer):
    class Meta:
        model = Customer
        fields = ('customeraccount', 'customername', 'address', 'phone','balance')

class EvalutionSerializer(serializers.ModelSerializer):
    class Meta:
        model = Evalution
        fields = ('orderno', 'times', 'service', 'productquality','transport','content')

class HistorySerializer(serializers.ModelSerializer):
    class Meta:
        model = History
        fields = ('customeraccount', 'saleraccount', 'productno', 'historydate')

class IncludeSerializer(serializers.ModelSerializer):
    class Meta:
        model = Include
        fields = ('orderno', 'productno', 'buyquantity')

class ProductSerializer(serializers.ModelSerializer):
    class Meta:
        model = Product
        fields = ('productno', 'productname', 'productintroduction', 'productdate')

class SaleSerializer(serializers.ModelSerializer):
    class Meta:
        model = Sale
        fields = ('saleraccount', 'productno', 'unitprice', 'quantity','dailysales','monthsales','annualsales','score','pic1','pic2')

class SaleorderSerializer(serializers.ModelSerializer):
    class Meta:
        model = Saleorder
        fields = ('orderno', 'saleraccount', 'customeraccount', 'orderdate','orderstatus','shopcar','totalprice','refund','transno')

class SalerSerializer(serializers.ModelSerializer):
    class Meta:
        model = Saler
        fields = ('saleraccount', 'storename', 'address', 'phone','balance','score')